﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;

namespace MVCCentral.Framework.Xml
{
    public class SelectBuilder
    {
        public enum BuilderTypes
        {
            Countries,
            USStates
        }

        public static List<SelectObject> Build(ControllerContext context, BuilderTypes ListType)
        {
            string path = context.HttpContext.Server.MapPath("~/xml/" + ListType.ToString() + ".xml");
            return Build(ListType, path);
        }

        public static List<SelectObject> Build(BuilderTypes ListType, string PathToXml)
        {
            SelectLoader loader = new SelectLoader(PathToXml);
            return loader.GetList(ListType.ToString());
        }
    }
}
